< previous page page_143 next page >

Page 143
Incorporating Object-Oriented Testing Services into ActiveX Components
As you progress in your knowledge of developing object-oriented components, you might find it necessary to incorporate test classes in your components for unit testing the component before deploying it. Thus, for every method called in your component, you could have one or more lines of code that invoke a method on the test class to record the values of incoming arguments, errors encountered within the method being tested, and the value of returns. In the lessons for Day 8, Versioning and Debugging, Day 14, The Internal Application Manager Subsystem, and Day 18, The Error-Processing and Exception-Handling Subsystem, you will learn more about structuring objects to incorporate self-testing logic within subsystems of classes and an entire application itself.
A Sample Test Project: The Samsona Bank Teller System Example
Now you will set up the project so that you can test your component. The name of the test project is TestCheckDeposit. To add a test project to the project group, do the following:
1. Choose File | Add Project from the menu. This opens the Add Project dialog box. Double-click the Standard EXE icon. This action creates a project group.
Note
Refrain from choosing File | Open Project or File | New Project. Doing so will close your ActiveX DLL project.

2. In the Properties Browser, rename the test project (now Project1) TestCheckDeposit.
3. In the Project Browser, right-click on TestCheckDeposit. Choose Set as Start Up from the pop-up menu. TestCheckDeposit is now the startup project for the project group. This step is necessary in order to test the ActiveX DLL.
4. From the menu, choose Project References. This opens the ReferencesTestCheckDeposit dialog box. Figure 6.11 shows this dialog box. Click the check box for CheckDeposit and then click OK.

 
< previous page page_143 next page >

If you like this book, buy it!